package javacode.chapter04;

import java.util.Scanner;

public class Example4_5 {
    public static void main(String[] args) {
        //判断某一年是否是闰年
        //闰年：
        // 1.如果年份能被400整除
        // 2.如果年份能被4整除，但不能被100整除
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入一个年份：");
        int year = scanner.nextInt();
        boolean leaf = false;

        if (year % 400 == 0) {
            leaf = true;
        } else if (year % 4 == 0) {
            if (year % 100 == 0) {
                //leaf=false;
            } else {
                leaf = true;
            }
        }

        if (leaf) {
            System.out.println(year + "是闰年！");
        } else {
            System.out.println(year + "是平年！");
        }
    }
}
